<template>
    <view>
        <u-popup v-model="show" mode="bottom" border-radius="40">
            <view class="shares-popup">
                <view class="content">
                    <view class="flex">
                        <view class="item" @tap="copy">
                            <image src="/static/icon_share2.png" class="icon" mode="widthFix"></image>
                            <view class="name">复制链接</view>
                        </view>
                        <view class="item" @tap="qrcode">
                            <image src="/static/icon_share3.png" class="icon" mode="widthFix"></image>
                            <view class="name">分享海报</view>
                        </view>
                        <view class="item" @tap="sendMsg">
                            <image src="/static/icon_share4.png" class="icon" mode="widthFix"></image>
                            <view class="name">分享短信</view>
                        </view>
                    </view>
                </view>
                <view class="btns" @tap="show=false">取消</view>
            </view>
        </u-popup>
    </view>
</template>

<script>
export default {
    components: {},
    data() {
        return {
        };
    },
    props: {
        value: {
            type: Boolean,
            default: false
        }
    },
    methods: {
        copy(){
            //#ifdef APP-PLUS
            uni.setClipboardData({
                data: 'hello',
                success() {
                    this.$common.showTip('链接复制剪切板成功','none')
                }
            });
            //#endif
           //#ifdef H5
           this.$common.showTip('链接复制剪切板成功','none')
           //#endif
            // uni.getClipboardData({
            //     success: function (res) {
            //         console.log(res.data);
            //     }
            // });
        },
        sendMsg(){
            //#ifdef APP-PLUS
            let msg = plus.messaging.createMessage(plus.messaging.TYPE_SMS);
            	// msg.to = ['18611497504', '15811140520'];
                msg.to = [''];
            	msg.body = 'This is HTML5 Plus example test message';
            	plus.messaging.sendMessage( msg );
             //#endif
            //#ifdef H5
            this.$common.showTip('h5不支持发送短信')
            //#endif
        },
        qrcode(){
            this.show = false;
            this.$emit('clickQrcode',true)
        },
    },
    computed:{
        show:{
            get(){
                return this.value
            },
            set(val){
                this.$emit('input', val);
            }
        }
    },
};
</script>

<style scoped lang="scss">
.shares-popup {
    .content {
        padding: 40rpx 0;
    }
    .item {
        flex: 1;
        text-align: center;
    }
    .icon {
        width: 110rpx;
        height: 110rpx;
    }
    .name {
        text-align: center;
        font-size: 13px;
        padding: 4px 0;
    }
    .btns {
        border-top: 1px solid $uni-border-color;
        padding: 20rpx 0;
        color: #999;
        line-height: 60rpx;
        text-align: center;
    }
}
</style>
